package com.yuanzi.base.filter;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自定义Filter注册
 * @author chengshx
 * @date 2017年7月17日
 *
 */
@Configuration
public class FilterConfig {

	@Bean
	public FilterRegistrationBean apiFilterBean() {
		FilterRegistrationBean registrationBean = new FilterRegistrationBean();
		registrationBean.setName("requestFilter");
		RequestFilter filter = new RequestFilter();
		registrationBean.setFilter(filter);
		registrationBean.setOrder(1);
		List<String> list = new ArrayList<String>();
		list.add("/*");
		registrationBean.setUrlPatterns(list);
		return registrationBean;
	}
}
